package com.wjh.kt_vod.controller;

import com.wjh.kt_vod.result.Result;
import com.wjh.kt_vod.service.VideoVisitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(tags = "VideoVisitor管理")
@RestController
@RequestMapping("/admin/vod/videoVisitor")
public class VideoVisitorController {

    @Autowired
    private VideoVisitorService videoVisitorService;

    @ApiOperation(value = "统计接口")
    @GetMapping("/findCount/{courseId}/{startDate}/{endDate}")
    public Result showChart(@PathVariable("courseId")
                                @ApiParam(name = "courseId" ,value = "课程id",required = true) Long courseId
            ,@PathVariable("startDate") @ApiParam("开始时间") String startDate
            ,@PathVariable("endDate") @ApiParam("结束时间") String endDate) {
        Map<String,Object> map = videoVisitorService.findCount(courseId,startDate,endDate);
        return Result.ok(map);
    }


}
